package com.declum.archon.chunkserver.handler.request;

import org.apache.mina.common.ByteBuffer;
import org.apache.mina.common.IoSession;

/**
 * {@link FakeRequestHandler} used to handle unrecognized command
 * 
 * @author Clement
 * 
 */
public class FakeRequestHandler extends BaseRequestHandler {

	/**
	 * Initializes the decoder and encoder
	 */
	public FakeRequestHandler() {
		super();
	}

	/**
	 * It just sends the string "Type not recognized"
	 */
	@Override
	public void process(IoSession session, Object msg) throws Exception {
		ByteBuffer out = ByteBuffer.allocate(1024);
		out.putString("Type not recognized", this.encoder);
		out.flip();
		session.write(out);
		session.close();
	}
}
